<template>
    <div>
        <el-card>
            <el-row :gutter="20">
                <el-col :span="20">
                    <el-tooltip effect="dark" content="刷新" placement="top" :enterable="false">
                        <el-button type="primary" size="small" :icon="icon"  @click="getCommunityStatistics"></el-button>
                    </el-tooltip>
                </el-col>
            </el-row>

            <el-table :data="communityStatisticsData"
                      ref="table"
                      border
                      style="width: 100%">
                <el-table-column
                        label="社区">
                    <template slot-scope="scope">
                        {{ scope.row.community.name ? scope.row.community.name : '暂无' }}
                    </template>
                </el-table-column>
                <el-table-column
                        prop="countCase"
                        label="总案件">
                </el-table-column>
                <el-table-column
                        prop="no_review_case_count"
                        label="未复查">
                </el-table-column>
                <el-table-column
                        prop="review_case_count"
                        label="已复查">
                </el-table-column>
                <el-table-column
                        prop="un_audit_count"
                        label="未审核">
                </el-table-column>
                <el-table-column
                        prop="audit_count"
                        label="已审核">
                </el-table-column>
                <el-table-column
                        prop="countFinish"
                        label="已整改">
                </el-table-column>
                <el-table-column
                        prop="countUnfinished"
                        label="未整改">
                </el-table-column>
                <el-table-column
                        prop="countRebound"
                        label="反弹">
                </el-table-column>
                <el-table-column
                        prop="countDisqualification"
                        label="不合格">
                </el-table-column>
            </el-table>
        </el-card>

    </div>
</template>

<script>
export default {
    name: "index",
    data(){
        return{
            icon: 'el-icon-refresh',

            communityStatisticsData:[],
            queryInfo:{
                limit: this.$global_limit,
                page: this.$global_page
            },
            total:0,
        }
    },
    created() {
        this.getCommunityStatistics()
    },
    methods:{
        async getCommunityStatistics(){
            const {data: res} = await this.$http.get('admin/get_community_list', {params: this.queryInfo})
            if (res.code !== 200) return this.$message.error('获取失败')
            this.communityStatisticsData = res.data.list
            this.total = res.data.totalCount
        },
        async del(id){
            const configResult = await this.$confirm('此操作将永久删除吗, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).catch(err => err);
            if (configResult !== 'confirm') return this.$message.info('已取消删除')
            const {data: result} = await this.$http.delete('admin/target_del/' + id)
            if (result.code !== 200) return this.$message.error(result.data.message)
            this.$message.success('删除成功')
            await this.getTargetList();
        },
    }
}
</script>

<style scoped>

</style>
